﻿var utils = utils || {};
utils.ajax = function (options) {
    if (!$) throw 'You must include jQuery to make an ajax'
    $.ajax({
        dataType: options.dataType || 'JSON', contentType: 'application/json', //config to submit json data
        url: options.url, type: options.type || 'POST', data: JSON.stringify(options.data), success: options.success,
        error: options.error
    });
};

utils.formatDate = function (date, formater) {
    date = date ? new Date(parseInt(date.replace(/[^\d.-]/g, ''), 10)) : null;
    return date && $.datepicker.formatDate('dd/mm/yy', date) || '';
};